<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Trida reprezentuje skladbu
 *
 * @author techi
 */
class Track
{

    /**
     *
     * @var string
     */
    
    private $_song;

    /**
     *
     * @var Artist
     */
    private $_artist;

    /**
     *
     * @param string $song
     * @param Artist|string $artist
     */
    public function __construct($song, $artist)
    {
        $this->_song = $song;

        if ($artist instanceof Artist)
        {
            $this->_artist = $artist;
        }
        else
        {
            $this->_artist = Artist::getInstance($artist);
        }
    }

    /**
     *
     * @return string
     */
    public function getSongName()
    {
        return $this->_song;
    }

    /**
     *
     * @return Artist
     */
    public function getArtist()
    {
        return $this->_artist;
    }

    /**
     *
     * @return string
     */
    public function getName()
    {
        return $this->getArtist()->getName() . ' - ' . $this->getSongName();
    }

    /**
     *
     * @return string
     */
    public function __toString()
    {
        return $this->getName();
    }

    /**
     *
     * @return Zend_Client_Result
     */

    public function getTopTags()
    {
        $lastFM = LastFM::getInstance();

        return $lastFM->getTrackTopTags($this->getArtist(), $this->getSongName());
    }

}
